#!/bin/bash

proc() {
    echo -e "\033[42;32m > $@ \033[0m" >&2
    local command=("$@")
    if "${command[@]}"; then
        echo -e "\033[42;32m SUCCEED \033[0m \n" >&2
    else
        echo -e "\033[41;32m FAILED \033[0m \n" >&2
        exit 1
    fi
}

proc rm ../*.deb
proc ssh 192.168.3.115 "rm *.deb"
proc make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bindeb-pkg -j16
proc scp ../*.deb 192.168.3.115:
proc ssh 192.168.3.115
# execute following cmd:
#   sudo dpkg -i *.deb
#   sudo reboot
